package com.ftf.tp.blog.infrastructure.mapper.pos;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.ftf.tp.common.annotation.DocId;
import com.ftf.tp.common.annotation.EsClass;
import com.ftf.tp.common.annotation.EsField;
import com.ftf.tp.common.constants.EsDataType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * 文章实体对象
 *
 * @author tanghao
 * @date 2022/6/26
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EsClass(shards = 3, replicas = 2, index = "article_test", alias = "article_a")
public class ArticleEs implements Serializable {

    @DocId
    private Long id;

    @EsField(name = "article_abstract", type = EsDataType.TEXT, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    @JsonProperty("article_abstract")
    private String articleAbstract;

    @EsField(name = "article_author_id", type = EsDataType.LONG)
    @JsonProperty("article_author_id")
    private Long articleAuthorId;

    @EsField(name = "article_author_name", type = EsDataType.TEXT, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    @JsonProperty("article_author_name")
    private String articleAuthorName;

    @EsField(name = "article_content_html", type = EsDataType.TEXT, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    @JsonProperty("article_content_html")
    private String articleContentHtml;

    /**
     * 文章内容markdown
     */
    @EsField(name = "article_content_markdown", type = EsDataType.TEXT, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    @JsonProperty("article_content_markdown")
    private String articleContentMarkdown;

    @EsField(name = "article_cover", type = EsDataType.KEYWORD)
    @JsonProperty("article_cover")
    private String articleCover;

    @EsField(name = "article_publish_status", type = EsDataType.INTEGER)
    @JsonProperty("article_publish_status")
    private Integer articlePublishStatus;

    @EsField(name = "article_status", type = EsDataType.INTEGER)
    @JsonProperty("article_status")
    private Integer articleStatus;

    @EsField(name = "article_title", type = EsDataType.TEXT, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    @JsonProperty("article_title")
    private String articleTitle;

    @EsField(name = "article_type", type = EsDataType.INTEGER)
    @JsonProperty("article_type")
    private Integer articleType;

    @EsField(name = "comment_status", type = EsDataType.INTEGER)
    @JsonProperty("comment_status")
    private Integer commentStatus;

    @EsField(name = "created_by", type = EsDataType.LONG)
    @JsonProperty("created_by")
    private Long createdBy;

    @EsField(name = "created_time", type = EsDataType.DATE)
    @JsonProperty("created_time")
    private Date createdTime;

    @EsField(name = "updated_time", type = EsDataType.DATE)
    @JsonProperty("updated_time")
    private Date updatedTime;

    @EsField(name = "delete_status", type = EsDataType.INTEGER)
    @JsonProperty("delete_status")
    private Integer deleteStatus;

}
